package com.csmz.mybookreader.DBSQLite;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class MyHelper extends SQLiteOpenHelper {
    //类没有实例化,是不能用作父类构造器的参数,必须声明为静态

    private static final String name = "User.db"; //数据库名称

    private static final int version = 1; //数据库版本

    private static final String CREATE_USER="create table UserInfo(" +
            "uid integer primary key autoincrement," +
            "nickname varchar(20)," +
            "upassword varchar(20),"+
            "year varchar(10)," +
            "gender varchar(10)," +
            "city varchar(20))";

    public MyHelper(Context context) {
        //第三个参数CursorFactory指定在执行查询时获得一个游标实例的工厂类,设置为null,代表使用系统默认的工厂类
        super(context, name, null, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL( CREATE_USER );
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) {

    }
}
